<?php
session_start();
$pfadTiefe = str_replace($_SERVER['DOCUMENT_ROOT'], "", dirname(__FILE__)."/" ); // alle nötigen PHP funktionen einfügen
$slashCount = substr_count($pfadTiefe, '/'); // Zählen wieviele Slashes drinne sind
$ebeneTiefer = ""; 
for($i=0; $i<$slashCount; $i++){ // für jeden slash eine ebene tiefergehen
	$ebeneTiefer .= DIRECTORY_SEPARATOR . '..';
}
$pfad = dirname(__FILE__).$ebeneTiefer;
require_once($pfad."/inc/inc_general_php_functions.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dota2 Lone Wolf League</title>
<?php
	require_once(DR.HOME_PATH_REL."/inc/inc_css_and_js.php");
?>

</head>

<body>
  <div id="wrap">
   <?php 
	 			$smarty->display('top_navi.tpl');
			?>
      <div class="container">
      	<?php 
	 		
	$matchID = 63;
	$teamWonID = 1;
	$steamID = 76561198006281562;
	$result = -1;
	$Match = new Match();
	$UserStats = new UserStats();
	$UserElo = new UserElo();
	
// 	$ret = $Match->getPlayersWhoLeftTheMatch($matchID);
	
// 	$ret = $UserStats->updateGeneralUserStats($steamID, $result, $matchID);
// 	$ret = $UserElo->getAllEloValuesOfUser($steamID, true,true);
	p($ret);
	
	$array[0]['SteamID'] = 76561198056439830;
	$array[0]['Elo'] = 1200;
	$array[0]['MatchModeID'] = 1;
	$array[0]['Region'] = 1;
	$array[0]['MatchTypeID'] = 1;
	
	$array[1]['SteamID'] = 76561198065060643;
	$array[1]['Elo'] = 1200;
	$array[1]['MatchModeID'] = 1;
	$array[1]['Region'] = 1;
	$array[1]['MatchTypeID'] = 1;
	
	$array[2]['SteamID'] = 76561198075352540;
	$array[2]['Elo'] = 1200;
	$array[2]['MatchModeID'] = 1;
	$array[2]['Region'] = 1;
	$array[2]['MatchTypeID'] = 1;
	
	$array[3]['SteamID'] = 76561198036113593;
	$array[3]['Elo'] = 1200;
	$array[3]['MatchModeID'] = 1;
	$array[3]['Region'] = 1;
	$array[3]['MatchTypeID'] = 1;
	$array[3]['GroupID'] = 15;
	
	$array[4]['SteamID'] = 76561198050039186;
	$array[4]['Elo'] = 1200;
	$array[4]['MatchModeID'] = 1;
	$array[4]['Region'] = 1;
	$array[4]['MatchTypeID'] = 1;
	$array[4]['GroupID'] = 14;
	
	$array[5]['SteamID'] = 76561198068803073;
	$array[5]['Elo'] = 1200;
	$array[5]['MatchModeID'] = 1;
	$array[5]['Region'] = 1;
	$array[5]['MatchTypeID'] = 1;
	$array[5]['GroupID'] = 15;
	
	$array[6]['SteamID'] = 76561198076067679;
	$array[6]['Elo'] = 1200;
	$array[6]['MatchModeID'] = 1;
	$array[6]['Region'] = 1;
	$array[6]['MatchTypeID'] = 1;
	$array[6]['GroupID'] = 14;
	
	$array[7]['SteamID'] = 76561198088047637;
	$array[7]['Elo'] = 1200;
	$array[7]['MatchModeID'] = 1;
	$array[7]['Region'] = 1;
	$array[7]['MatchTypeID'] = 1;
	
	$array[8]['SteamID'] = 76561198053065928;
	$array[8]['Elo'] = 1200;
	$array[8]['MatchModeID'] = 1;
	$array[8]['Region'] = 1;
	$array[8]['MatchTypeID'] = 1;
	
	$array[9]['SteamID'] = 76561198047012055;
	$array[9]['Elo'] = 1200;
	$array[9]['MatchModeID'] = 1;
	$array[9]['Region'] = 1;
	$array[9]['MatchTypeID'] = 1;
	
	
// 	$array[0]['SteamID'] = 76561198056439830;
// 	$array[0]['Elo'] = 1200;
// 	$array[0]['MatchModeID'] = 1;
// 	$array[0]['Region'] = 1;
// 	$array[0]['MatchTypeID'] = 1;
	
// 	$array[1]['SteamID'] = 76561198065060643;
// 	$array[1]['Elo'] = 1200;
// 	$array[1]['MatchModeID'] = 1;
// 	$array[1]['Region'] = 1;
// 	$array[1]['MatchTypeID'] = 1;
	
// 	$array[2]['SteamID'] = 76561198075352540;
// 	$array[2]['Elo'] = 1200;
// 	$array[2]['MatchModeID'] = 1;
// 	$array[2]['Region'] = 1;
// 	$array[2]['MatchTypeID'] = 1;
	
// 	$array[3]['SteamID'] = 76561198036113593;
// 	$array[3]['Elo'] = 1200;
// 	$array[3]['MatchModeID'] = 1;
// 	$array[3]['Region'] = 1;
// 	$array[3]['MatchTypeID'] = 1;
// 	$array[3]['GroupID'] = 15;
	
// 	$array[4]['SteamID'] = 76561198050039186;
// 	$array[4]['Elo'] = 1200;
// 	$array[4]['MatchModeID'] = 1;
// 	$array[4]['Region'] = 1;
// 	$array[4]['MatchTypeID'] = 1;
// 	$array[4]['GroupID'] = 14;
	
// 	$array[5]['SteamID'] = 76561198068803073;
// 	$array[5]['Elo'] = 1200;
// 	$array[5]['MatchModeID'] = 1;
// 	$array[5]['Region'] = 1;
// 	$array[5]['MatchTypeID'] = 1;
// 	$array[5]['GroupID'] = 15;
	
// 	$array[6]['SteamID'] = 76561198076067679;
// 	$array[6]['Elo'] = 1200;
// 	$array[6]['MatchModeID'] = 1;
// 	$array[6]['Region'] = 1;
// 	$array[6]['MatchTypeID'] = 1;
// 	$array[6]['GroupID'] = 14;
	
// 	$array[7]['SteamID'] = 76561198088047637;
// 	$array[7]['Elo'] = 1200;
// 	$array[7]['MatchModeID'] = 1;
// 	$array[7]['Region'] = 1;
// 	$array[7]['MatchTypeID'] = 1;
// 	$array[7]['GroupID'] = 12;
	
// 	$array[8]['SteamID'] = 76561198053065928;
// 	$array[8]['Elo'] = 1200;
// 	$array[8]['MatchModeID'] = 1;
// 	$array[8]['Region'] = 1;
// 	$array[8]['MatchTypeID'] = 1;
	
// 	$array[9]['SteamID'] = 76561198047012055;
// 	$array[9]['Elo'] = 1200;
// 	$array[9]['MatchModeID'] = 1;
// 	$array[9]['Region'] = 1;
// 	$array[9]['MatchTypeID'] = 1;
// 	$array[9]['GroupID'] = 12;
	
	$MatchTeams = new MatchTeams();
	//$ret = $MatchTeams->insertPlayersIntoMatchTeamsAfterFoundMatchmaking("nicht null", $array);
	//p($ret);
	//$matchID = $ret['matchID'];
// 	$matchID = 724;
// 	p($matchID);
// 	$dataRet = $Match->checkAllReadyForMatch($matchID);
// 	$data = $dataRet['data'];
	
// 	p($dataRet);
	
// 	$SmartyFetch = new SmartyFetch();
// 	$html = $SmartyFetch->fetchWaitingForOtherPlayersTPL($smarty, $data);
	
	//echo $html['data'];
	
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198047012055);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198053065928);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198088047637);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198076067679);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198068803073);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198050039186);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198075352540);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198065060643);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198056439830);
// 	$MatchTeams->cleanMatchTeamsOfPlayer(76561198036113593);
	
// 	$Match->deleteCreatedMatch($matchID);
	
	$EventType = new EventType();
	$ret = $EventType->calculateNextStartTimestamp("17:00", "Wednesday");
	
	p($ret);
	
				?>
      </div> <!-- /container -->
    </div>
    <div id="footer">
      <div class="container">
        <?php $smarty->display('footer.tpl'); ?>
      </div>
    </div>
    <?php $smarty->display('general_stuff.tpl');?>
</body>
</html>